<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s" %>
<%--@elvariable id="maintainItem" type="org.apache.myfaces.orchestra.examples.backings.MaintainItem"--%>

<html>
<head><title>Simple PureHibenate Test</title></head>
<body>
<h1>Simple PureHibenate Test</h1>
<f:view>
	<h:form>
		<s:subForm id="table">
			<h:dataTable
				var="item"
				value="#{maintainItem.items}">
				<h:column>
					<f:facet name="header">
						<h:outputText value="instance"/>
					</f:facet>
					<h:outputText value="#{item}"/>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="id"/>
					</f:facet>
					<h:outputText value="#{item.id}"/>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="text"/>
					</f:facet>
					<h:outputText value="#{item.text}"/>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="version"/>
					</f:facet>
					<h:outputText value="#{item.version}"/>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="action"/>
					</f:facet>
					<h:commandButton
						value="select"
						action="#{maintainItem.selectItemAction}">
						<f:setPropertyActionListener target="#{maintainItem.currentItem}" value="#{item}"/>
					</h:commandButton>
				</h:column>
			</h:dataTable>
		</s:subForm>

		<s:subForm id="form" preserveSubmittedValues="false">
			<h:panelGrid columns="2">
				<f:facet name="header">
					<h:outputText value="current item"/>
				</f:facet>

				<h:outputText value="instance"/>
				<h:outputText value="#{maintainItem.currentItem}"/>

				<h:outputText value="id"/>
				<h:outputText value="#{maintainItem.currentItem.id}"/>

				<h:outputText value="text"/>
				<h:inputText value="#{maintainItem.currentItem.text}"/>

				<h:outputText value="version"/>
				<h:outputText value="#{maintainItem.currentItem.version}"/>

				<h:outputText/>
				<h:panelGrid columns="2">
					<h:commandButton
						value="save"
						action="#{maintainItem.saveItemAction}"/>
					<h:commandButton
						value="new"
						action="#{maintainItem.newItemAction}"/>

				</h:panelGrid>

			</h:panelGrid>
		</s:subForm>

		<h:commandButton
			value="newConversation"
			action="#{maintainItem.startOverConversationAction}"/>
		
	</h:form>
</f:view>
</body>
</html>